package com.java8.ch06;

// This program uses a parameterized method.
public class BoxDemo5 {
	public static void main(String[] args) {
		Box5 mybox1 = new Box5();
		Box5 mybox2 = new Box5();
		// initialize each box
		mybox1.setDim(10, 20, 15);
		mybox2.setDim(3, 6, 9);
		// get Volume
		System.out.println("Mybox1's Volume is " + mybox1.volume());
		System.out.println("Mybox2's Volume is " + mybox2.volume());
	}
}

class Box5 {

	double width;
	double height;
	double depth;

	// compute and return volume of a box
	double volume() {
		return width * height * depth;
	}

	// sets dimensions of box
	void setDim(double w, double h, double d) {
		width = w;
		height = h;
		depth = d;
	}
}
